package skymatts;

/**
 * Open Source Athletics Management Software.
 * 
 * @Dirk B Staples, Matt Bone, Aadeel,Eric   
 * @09.12.2007-10.12.07,e11.28.07
 */

import java.io.*;
import java.util.*;
public class skylhistogram {

private static BufferedReader stdin = new BufferedReader ( new InputStreamReader ( System.in ) );

    public static void main(String[] args) throws Exception {
        Sportz wBasketball = new Sportz();
        wBasketball.setSportname("Women's International Basketball");
        
        Teams wUsaBb = new Teams();
        wUsaBb.setTeamname("WNT");
        
        ArrayList<Teams> teams = new ArrayList<Teams>();
        teams.add(wUsaBb);
        wBasketball.setTeams(teams);
        
        System.out.println("Welcome to SKYLINES...An Open Source Athletics Management Software, you are system user, please keep this number for further reference");
        
        System.out.println("Are you interested in Men's or Women's athletics? Please enter M or W.");
        String sex = stdin.readLine();
        if(sex.equalsIgnoreCase("m")) {
            System.out.println("You chose Men's, unfortunaley at this time, there are no databases initialized concerning Men's athletics");
             for (int i=1; i<25; i++ ) {
                System.out.println();
            }
        } else {
            System.out.println("You chose Women's athletics, \n Enter the specific data you would like to view \n\n1) Basketball \n2) Field Hockey \n3) Lacrosse \n4) Soccer \n5) Softball \n6) Volleyball");
            String answer = stdin.readLine();
            System.out.println(createHistogram(answer));
            
     
        }
        
        
        
    }
public static Map createHistogram (String answer){

       /**
         * Steps:
         * 1) convert to lower case
         * 2) split input into an array of strings
         * 3) create an empty map
         * 4) loop over the array
         *   A) if the word is in the map, add one to the occurrence
         *   B) if the word is not in the map, put it in with an occurrence of one
         */
        
    answer.toLowerCase();
    String stored[]= answer.split(", ");
    HashMap<String, Integer> map = new HashMap<String, Integer>();
    for (int i = 0; i < stored.length; i++ ) {
       if (map.containsKey (stored [i])) {
        map.put (stored[i], map.get (stored[i]) + 1);
       }
       else
       {
        map.put(stored[i], 1);
       }
    }

        
        //System.out.println("Welcome to SKYLINES...An Open Source Athletics Management Software");
        return map;

    }
}
